package com.sj.purchase.modules.helper.web;

import com.sj.purchase.modules.helper.model.OutBoundUniqueCode;
import org.springframework.beans.BeanUtils;

import java.util.Objects;

/**
 * @author yangrd
 * @date 2018/8/23
 **/
class OutBoundUniqueCodeAssembler {

    static OutBoundUniqueCodeVO toVO(OutBoundUniqueCode outBoundUniqueCode) {
        OutBoundUniqueCodeVO vo = new OutBoundUniqueCodeVO();
        BeanUtils.copyProperties(outBoundUniqueCode, vo);
        String address = Objects.isNull(outBoundUniqueCode.getStateName()) ? "" : String.format("%s %s %s", outBoundUniqueCode.getStateName(), outBoundUniqueCode.getCityName(), outBoundUniqueCode.getDistrictName());
        vo.setAddress(address);
        return vo;
    }
}
